<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
  //自定义对象
  var User = {
    name:"zhagnsan",
    gender:"男",
    age:23,
    getName:function () {return this.name;},
    getSum: function (a, b) {return a + b;},
    eat: function () {alert("张三爱吃鱼。。。");}
  };
  //调用属性
  var age = User.age;
  alert(age); //23
  //调用函数
  var name = User.getName();
  var sum = User.getSum(1,2);
  User.eat(); //张三爱吃鱼。。。
  alert(name);  //zhagnsan
  alert(sum); //3
</script>
</body>
</html>